package com.shanks.home.util.time;

import java.util.Calendar;
import java.util.concurrent.TimeUnit;

import com.shanks.home.framework.CoreContext;
import com.shanks.home.util.LogUtil;

/**
 * 当前本地时间
 * @author Shanks
 * @time 2014.04.09
 */
public class LocalTime {
	private static String TAG = LocalTime.class.getSimpleName();
	private static boolean hasStarted = false;	
	public static void startGetTime() {
		if (!hasStarted) {
			hasStarted = true;
			CoreContext.scheduleExecutorService.scheduleWithFixedDelay(runnable, 0, 1000, TimeUnit.MILLISECONDS);
		}		
	}
	
	private static Runnable runnable = new Runnable() {
		
		@Override
		public void run() {
			Calendar calendar = Calendar.getInstance();
			LogUtil.i(TAG, "hour:" + calendar.get(Calendar.HOUR_OF_DAY) + ", minute:" + calendar.get(Calendar.MINUTE));
		}
	};
}